package com.yanqu.road.server.cross3server.cmd.washe;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.WasheProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.protocol.ChannelProtocol;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.Cross3Protocol;
import com.yanqu.road.utils.ConfigHelper;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = Cross3Protocol.C3_WASHE_SEE_OTHER_USER_DATA_RESP, desc = "")
public class Cross3WasheSeeOtherUserDataRespCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        WasheProto.ChannelWasheSeeOtherUserDataRespMsg respMsg = WasheProto.ChannelWasheSeeOtherUserDataRespMsg.parseFrom(packet.getBytes());

        if (respMsg.getFromChannelId() == ConfigHelper.getInt("channelId")) {
            // 自己渠道
            YanQuMessage message = YanQuMessageUtils.buildMessage(ClientProtocol.U_WASHE_SEE_OTHER_USER_DATA, respMsg.getResp().toBuilder());
            MessageHelper.sendPacket(respMsg.getFromServerId(), respMsg.getFromUserId(), message);
        } else {
            // 其他渠道
            YanQuMessage message = YanQuMessageUtils.buildMessage(ChannelProtocol.N_WASHE_SEE_OTHER_USER_DATA_RESP, respMsg.toBuilder());
            MessageHelper.sendChannelServer(message);
        }
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

    }

    @Override
    public void sendData() {

    }
}
